/*
 * @Description: 
 * @Author: chaixinyu
 * @Date: 2022-08-11 11:30:51
 * @LastEditors: 47
 * @LastEditTime: 2023-04-16 15:25:56
 */
// 当前这个模块：API统一管理
import requests from './ajax'

//获取课程下的考试列表
export const reqGetCourseTestList = (courseId,userId) => {
    return requests({
        method: 'get',
        url: `/course/getCourseTestList/${courseId}/${userId}`
    })
}

//获取考试详情
export const reqGetCourseTestDetail = (testId) => {
    return requests({
        method: 'get',
        url: `/course/getCourseTestDetail/${testId}`
    })
}


//获取课程下的作业列表
export const reqGetCourseHomeworkList = (courseId,userId) => {
    return requests({
        method: 'get',
        url: `/course/getCourseHomeworkList/${courseId}/${userId}`
    })
}

//获取作业详情
export const reqGetCourseHomeworkDetail = (homeworkId) => {
    return requests({
        method: 'get',
        url: `/course/getCourseHomeworkDetail/${homeworkId}`
    })
}


//获取章节标题列表
export const reqGetChapterInfo = (courseId, userId) => {
    return requests({
        method: 'get',
        url: `/course/getChapterInfo/${courseId}/${userId}`
    })
}

//获取章节详情
export const reqGetChapterDetail = (chapterId, userId) => {
    return requests({
        method: 'get',
        url: `/course/getChapterDetail/${chapterId}/${userId}`
    })
}


//更新章节详情里的任务点
export const reqUpdateDetailTaskPoint = (detailId, userId) => {
    return requests({
        method: 'get',
        url: `/course/updateDetailTaskPoint/${detailId}/${userId}`
    })
}

//更新章节标题任务点
export const reqUpdateChapterTaskPoint = (chapterId, userId) => {
    return requests({
        method: 'get',
        url: `/course/updateChapterTaskPoint/${chapterId}/${userId}`
    })
}

// 获取自选课程列表
export const reqGetMoreCourseList = () => {
    return requests({
        method: 'get',
        url: '/course/getMoreCourseList'
    })
}

// 修改课程状态
export const reqUpdateCourseStatus = (courseId) => {
    return requests({
        method: 'post',
        url: `/course/updateCourseStatus/${courseId}`
    })
}

// 获取我的课程列表
export const reqGetMyCourseList = (userId, keyword = "") => {
    return requests({
        method: 'get',
        url: `/course/getMyCourseList/${userId}/${keyword}`
    })
}

// 将自选课程添加到我的课程
export const reqAddMyCourse = (data) => {
    return requests({
        method: 'post',
        url: `/course/addMyCourse`,
        data
    })
}

// 根据“courseId”获取课程下的通知列表 
export const reqGetCourseNoticeList = (courseId, userId) => {
    return requests({
        method: 'get',
        url: `/course/getCourseNoticeList/${courseId}/${userId}`,
    })
}

//根据“noticeId”获取通知详情页信息以及对应的评论区 
export const reqGetNoticeDetail = (noticeId,userId) => {
    return requests({
        method: 'get',
        url: `/course/getNoticeDetail/${noticeId}/${userId}`,
    })
}

//根据“courseId”获取课程的讨论列表 
export const reqGetCourseDiscussList = (courseId,userId) => {
    return requests({
        method: 'get',
        url: `/course/getCourseDiscussList/${courseId}/${userId}`,
    })
}

//根据“discussId”获取讨论详情页信息以及对应的评论区  
export const reqGetDiscussDetail = (discussId,userId) => {
    return requests({
        method: 'get',
        url: `/course/getDiscussDetail/${discussId}/${userId}`,
    })
}

//根据“courseId,userId”获取课程的签到列表 
export const reqGetCourseSignList = (courseId, userId) => {
    return requests({
        method: 'get',
        url: `/course/getCourseSignList/${courseId}/${userId}`,
    })
}

//根据noticeId和userId更新通知状态
export const reqUpdateNoticeStatus = (noticeId, userId) => {
    return requests({
        method: 'get',
        url: `/course/updateNoticeStatus/${noticeId}/${userId}`,
    })
}

//根据signId和userId更新签到状态
export const reqUpdateSignStatus = (signId, userId) => {
    return requests({
        method: 'get',
        url: `/course/updateSignStatus/${signId}/${userId}`,
    })
}

//更新签到时间 
export const reqGetSignTime = (data) => {
    return requests({
        method: 'post',
        url: `/course/getSignTime`,
        data
    })
}

// 获取签到成功时间
export const reqGetSignSuccessTime = (data) => {
    return requests({
        method: 'post',
        url: `/course/getSignSuccessTime`,
        data
    })
}

//查询该课程下的全部任务点数量
export const reqGetCourseTaskPointNum = (courseId) => {
    return requests({
        method: 'get',
        url: `/course/getCourseTaskPointNum/${courseId}`,
    })
}
//查询这个课程下我已经完成的任务点
export const reqGetMyOkTaskNumTheCourse = (courseId,userId) => {
    return requests({
        method: 'get',
        url: `/course/getMyOkTaskNumTheCourse/${courseId}/${userId}`,
    })
}

//提交作业/考试
export const reqAddContent = (data) => {
    return requests({
        method: 'post',
        url: `/course/addContent`,
        data
    })
}

//点赞
export const reqToLike = (data) => {
    return requests({
        method: 'post',
        url: `/course/toLike`,
        data
    })
}



// 上传图片文件
export const reqUpload = (data) => {
    return requests({
        method: 'post',
        url: `/course/upload`,
        data
    })
}

// 添加评论
export const reqAddComment = (data) => {
    return requests({
        method: 'post',
        url: `/course/addComment`,
        data
    })
}

//查询通知/讨论点赞用户列表
export const reqGetLikeList = (id,judgeCode) => {
    return requests({
        method: 'get',
        url: `/course/getLikeList/${id}/${judgeCode}`,
    })
    
}

// 登录login接口
export const reqUserLogin = (params) => {
    return requests({
        method: 'post',
        url: '/api/login',
        data: params
    })
}

// 手机验证码登录smsLogin接口
export const reqUserLoginBySms = (params) => {
    return requests({
        method: 'post',
        url: '/api/verifySmsToLogin',
        data: params
    })
}

// 获取用户信息接口
export const reqGetUserInfo = () => {
    return requests({
        method: 'get',
        url: '/admin/getUserInfo'
    })
}

//注册接口
export const reqRegisterUser = (params) => {
    return requests({
        method: 'post',
        url: '/api/register',
        data: params
    })
}

// -----------闫一丹 群聊区域------------------
// 获取我的群聊列表
export const getMyChat = () => {
    return requests({
        method: 'get',
        url: '/my/chat' 
    })
}
// 获取我的群聊的人员
export const getMyChatPelple = () => {
    return requests({
        method: 'get',
        url: '/my/people' 
    })
}
// 新增群聊
export const addChat = (params) => {
    return requests({
        method: 'post',
        url: '/my/addChat', 
        data: params
    })
}
// -----------闫一丹 笔记区域------------------
// 获取笔记列表
export const getShareNoteList = (id) => {
    return requests({
        method: 'get',
        url: `/note/noteList/${id}`
    })
}
// 添加笔记
export const writeNote = (params) => {
    return requests({
        method: 'post',
        url: '/note/addNote',
        data: params 
    })
}
// 获取笔记分类
export const getArticleById = (note_id) => {
    return requests({
        method: 'get',
        url: `/note/cates/${note_id}`
    })
}

// 文件上传接口
export const reqUploadFile = (data)=>{
    return requests({
        method: 'post',
        url:'/note/upload',
        data
    })
}
// 获取用户名字首字母
export const getuserMsg = (params) => {
    return requests({
        method: 'post',
        url: '/friend/userMsg',
        data: params 
    })
}
// 获取好友列表
export const getFriendsList = (params) => {
    return requests({
        method: 'post',
        url: '/friend/getfriendMsg',
        data: params 
    })
}
// -----------------闫一丹 Ending--------------

//注册完成之后添加用户姓名接口
export const reqAddUserName = (params) => {
    return requests({
        method: 'post',
        url: '/api/addName',
        data: params
    })
}

// 修改用户姓名接口
export const reqUpdateUserName = (params) => {
    return requests({
        method: 'post',
        url: '/admin/updateUserName',
        data: params
    })
}

// 修改用户签名接口
export const reqUpdateUserDesc = (params) => {
    return requests({
        method: 'post',
        url: '/admin/updateUserDesc',
        data: params
    })
}

// 修改用户性别接口
export const reqUpdateUserSex = (params) => {
    return requests({
        method: 'post',
        url: '/admin/updateUserSex',
        data: params
    })
}

// 获取手机验证码接口(登录时候无token)
export const reqGetSms = (phone) => {
    return requests({
        method: 'get',
        url: `/api/getSms?phone=${phone}`,
    })
}

// 获取手机验证码接口(token验证)
export const reqGetSmsByToken = (phone) => {
    return requests({
        method: 'get',
        url: `/admin/getSmsByToken?phone=${phone}`,
    })
}

// 获取验证码后更新绑定用户手机号(token)
export const reqUpdateUserPhone = (params) => {
    return requests({
        method: 'post',
        url: '/admin/updatePhone',
        data: params
    })
}

// 校验验证码
export const reqVerifySmsToResetPasswordPage = (params) => {
    return requests({
        method: 'post',
        url: '/admin/verifySmsToResetPasswordPage',
        data: params
    })
}

// 重置密码(验证手机验证码之后)
export const reqResetUserPassword = (params) => {
    return requests({
        method: 'post',
        url: '/admin/resetUserPassword',
        data: params
    })
}

// 修改密码(输入新旧密码)
export const reqUpdateUserPassword = (params) => {
    return requests({
        method: 'post',
        url: '/admin/updateUserPassword',
        data: params
    })
}

